package com.sgb.kjwl.view.ui.activity.transport;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityBiddingTransportHallBinding;
import com.sgb.kjwl.view.constant.RouterKey;
import com.sgb.kjwl.view.ui.fragment.transport.GoodsHallListFragment;

/**
 * Describe:
 * Author:  yangLei
 * Date:    2021/12/8
 */
public class BiddingTransportHallActivity extends AppActivity {

    private ActivityBiddingTransportHallBinding binding;
    private String goodsNo = "Default_GoodsType";

    public static void start(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, BiddingTransportHallActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }

    public static void start(Context context, String goodsNo) {
        Intent intent = new Intent();
        intent.setClass(context, BiddingTransportHallActivity.class);
        intent.putExtra(RouterKey.NO, goodsNo);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String no = getIntent().getStringExtra(RouterKey.NO);
        if (!TextUtils.isEmpty(no)) {
            goodsNo = no;
        }
        binding = DataBindingUtil.setContentView(this, R.layout.activity_bidding_transport_hall);
        binding.includeTitle.titleView.setText("竞价货运");
        binding.includeTitle.ivBack.setOnClickListener(v -> finish());
        GoodsHallListFragment fragment = GoodsHallListFragment.newInstance(1, true, true, true, false, goodsNo);
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment).commit();
    }
}
